import { createRouter, createWebHistory } from 'vue-router';
import homeRoutes from './home';
import dituRoutes from './ditu';
import dcRoutes from './tanchuang';
import echarts from './echarts';
import nineRoutes from './nine';
import htmlImgRoutes from './htmlImg';
import uploadRoutes from './upload';
import atableRoutes from './atable';
// 404页面
const page404 = {
  path: '/:catchAll(.*)',
  name: 'pageNotFound',
  component: () =>
    import(/* webpackChunkName: "404" */ '../views/404/index.vue')
};
const routes = [
  ...homeRoutes,
  ...dituRoutes,
  ...dcRoutes,
  ...echarts,
  ...nineRoutes,
  ...htmlImgRoutes,
  ...uploadRoutes,
  ...atableRoutes,
  page404
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
});
router.beforeEach((to, from, next) => {
  console.log(to, from);
  next();
});
export default router;
